#!/bin/sh

# _PID=$1
# _TMP=$(pwd)/$_PID.tmp
# touch $_TMP
# _TXT=$(pwd)/$_PID.txt
# touch $_TXT
# while true 
# do
#     if [ -f /proc/$_PID/status ]; then
#         cat /proc/$_PID/status > $_TMP
#         _VMRSS=`cat $_TMP | grep VmRSS | awk '{print $2}'`

#         current=`date "+%Y-%m-%d %H:%M:%S"`
#         timeStamp=`date -d "$current" +%s` 
#         currentTimeStamp=$(((timeStamp*1000+10#`date "+%N"`/1000000)/1000)) #将current转换为时间戳，精确到秒

#         echo ${currentTimeStamp} "," ${_VMRSS} >> $_TXT
#     fi
#     sleep 1
# done


_PID=$1
_TMP=$(pwd)/$_PID.tmp
touch $_TMP
_TXT=$(pwd)/$_PID.txt
touch $_TXT
index=0
while true 
do
    if [ -f /proc/$_PID/status ]; then
        cat /proc/$_PID/status > $_TMP
        _VMRSS=`cat $_TMP | grep VmRSS | awk '{print $2}'`

        index=`expr $index + 60`
        echo ${index} "," ${_VMRSS} >> $_TXT
    fi
    sleep 60
done